package com.mall.order.biz.convert;


import com.mall.order.dal.entitys.Order;
import com.mall.order.dal.entitys.OrderItem;
import com.mall.order.dal.entitys.OrderShipping;
import com.mall.order.dto.OneOrderDto;
import com.mall.order.dto.OrderDetailInfo;
import com.mall.order.dto.OrderItemDto;
import com.mall.order.dto.OrderShippingDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import javax.annotation.Resource;
import javax.xml.transform.Source;
import java.util.List;

/**
 * @author: lsy
 * @interface: Do2DtoConvert
 */
@Mapper(componentModel = "spring")
public interface Do2DtoConvert {

    // 除了orderItemDto orderShippingDto都转化过来了
    @Mappings({})
    List<OrderDetailInfo> orders2OrderDetailInfos(List<Order> orders);

    @Mappings({})
    List<OrderItemDto> orderItems2OrderItemDtos(List<OrderItem> orderItems);

    @Mappings({
            @Mapping(source = "status", target = "orderStatus")
//            @Mapping(source = "payment", target = "orderTotal"),
    })
    OneOrderDto order2OneOrderDto(Order order);

    @Mappings({})
    OrderShippingDto orderShipping2OrderShippingDto(OrderShipping orderShipping);
}
